#pragma once

#include <iostream>
#include <ctime>
#include <string>

#define NORMAL 1
#define DEBUG 2
#define WARNING 3
#define FATAL 4

#define LOG(LEVEL, MESSAGE) log(#LEVEL, MESSAGE, __FILE__, __LINE__)

std::string Gettime()
{
    time_t curr=std::time(nullptr);
    // return std::ctime(&curr);//自带换行符
    return std::string(std::ctime(&curr)).erase(24,1);//第24位是"\n"
}
void log(const std::string& level,const std::string& message,const std::string& file,const int line)
{
    std::cout<<"["<<Gettime()<<"]"<<"["<<level<<"]"<<"["<<file<<": "<<line<<"]"<<message<<std::endl;
}